package com.recSystem.Entity.Converters;

import com.recSystem.Entity.DO.UserDO;
import com.recSystem.Entity.DTO.UserInfoDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @author Legolas_PRC
 * @date 2023/3/31 19:46
 **/
@Mapper
public interface UserConverter {
    UserConverter INSTANCE = Mappers.getMapper(UserConverter.class);
    @Mapping(source = "userId",target = "id")
    @Mapping(source = "username", target = "username")
    @Mapping(source = "realname", target = "realname")
    @Mapping(source = "gender", target = "gender")
    @Mapping(source = "major", target = "major")
    @Mapping(source = "workplace", target = "workplace")
    @Mapping(source = "researchfield", target = "researchfield")
    @Mapping(source = "email", target = "email")
    @Mapping(source = "phone", target = "phone")
    @Mapping(source = "lastLogin", target = "last_login")
    @Mapping(source = "password", target = "password")
    UserInfoDTO userToUserInfoDTO(UserDO user);
}
